package cn.accp.sartwar;

import java.util.Scanner;

import cn.accp.level.LevelBase;
import cn.accp.level.impl.ForestLevel;
import cn.accp.level.impl.LandLevel;
import cn.accp.level.impl.SeaLevel;
import cn.accp.level.impl.SkyLevel;
import cn.accp.sartwar.base.Hero;
import cn.accp.sartwar.base.Monster;

public class Game {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int choice;
		do {
			System.out.println("请选择游戏关卡：");
			System.out.println("1.海洋大战");
			System.out.println("2.陆上争霸");
			System.out.println("3.天空大战");
			System.out.println("4.森林争雄");
			System.out.println("5.游戏退出");
			choice = input.nextInt();
		} while (choice < 1 || choice > 5);
		if (choice == 5) {
			System.out.println("游戏退出了，再见！");
		} else {

			Game game = new Game();
			LevelBase level = game.creatLevel(choice);
			Monster monster = level.createMonster();
			Hero hero = level.createHero();
			game.play(hero, monster);
		}
	}

	public void play(Hero hero, Monster monster) {
		monster.jump();
		hero.run();
		hero.attack();
		monster.attack();
	}

	public LevelBase creatLevel(int choice) {
		LevelBase level = null;
		switch (choice) {
		case 1:
			level = new SeaLevel();
			break;
		case 2:
			level = new LandLevel();
			break;
		case 3:
			level = new SkyLevel();
			break;
		case 4:
			level = new ForestLevel();
			break;
		default:
			break;
		}
		return level;
	}
}
